﻿using System;
using System.Collections.Generic;
using System.Linq;
using ESRI.ArcGIS.Carto;

namespace LabelForDem
{
    public class GraphicsContainer
    {
        public static void Draw3DText(List<IText3DElement> elements)
        {
            var container = ArcScene.Document.Scene.ActiveGraphicsLayer as IGraphicsContainer;
            if (container == null || elements == null)
                throw new Exception("添加标注失败");
            foreach (var element in elements.Select(text3DElement => text3DElement as IElement))
                container.AddElement(element, 0);
        }

        public static void Delete3DText(List<IText3DElement> elements)
        {
            var container = ArcScene.Document.Scene.ActiveGraphicsLayer as IGraphicsContainer;
            if (container == null || elements == null) return;
            foreach (var text3DElement in elements)
            {
                var element = text3DElement as IElement;
                container.DeleteElement(element);
            }
        }
    }
}